import { Model, DataType, } from "sequelize-typescript";
import { Table, Column } from './decorate';

@Table({
    underscored: true,
    underscoredAll: true,
    timestamps: true,
    paranoid: true,
    indexes: [
        {
            fields: ['url_hash']
        },
        {
            fields: ['shorturl']
        }
    ]
})
export default class ShortUrl extends Model<ShortUrl> { 

    @Column
    shorturl !: string ;
    
    @Column({
        type: DataType.TEXT
    })
    url !: string ;

    @Column
    urlHash !: string ;
}